package com.song.tools.mvc.validator;

import com.song.tools.core.exception.BusinessException;
import com.song.tools.core.exception.ExceptionCodeEnum;

import java.io.Serial;

/**
 * 参数校验异常
 *
 * @author song tools
 * @since 2024-06-21
 */
public class ValidationException extends BusinessException {
    @Serial
    private static final long serialVersionUID = 5177814126744016279L;

    public ValidationException() {
        super(ExceptionCodeEnum.PARAM_NOT_VALID);
    }

    public ValidationException(String message) {
        super(ExceptionCodeEnum.PARAM_NOT_VALID.getCode(), message);
    }

    /**
     * 创建一个参数校验异常
     *
     * @param message 异常信息
     * @return 参数校验异常
     */
    public static ValidationException message(String message) {
        return new ValidationException(message);
    }
}
